<!-- html -->
<template>
  <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="货主名称" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入货主名称"
          clearable
          @keyup.enter="handleQuery"
        />
      </el-form-item>
      
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
</template>

<!-- 
      ts
      setup 支持setup语法糖
 -->
<script lang="ts" setup>
  import { toRefs,ref,reactive, } from 'vue';


let props = defineProps({
  showSearch:{
    type:Boolean,
    default:false
  },
  queryParams:{
    type:Array,
    default:null
  }
})

let {showSearch} = toRefs(props)
const queryParams = ref({
  pageNum: 1,
    pageSize: 10,
    name: null,

})

//搜索
const handleQuery = ()=>{
  emits("handleQuery",queryParams)
}
const queryRef = ref()
const emits = defineEmits(["resetQuery","handleQuery"])
//重置表单
const resetQuery = async ()=>{
  await queryRef.value.resetFields();
  handleQuery();
}

</script>

<!-- css样式 -->
 <style scoped>
</style>